package pck_ImageLoader;

import android.content.Context;
import android.content.res.Resources;
import android.os.Environment;
import android.util.Log;
import baseClass.Global;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class ImageLoadManager
{
  public boolean CheckDirectoryExists(String paramString1, String paramString2)
  {
    if ("mounted".equals(Environment.getExternalStorageState())) {}
    for (File localFile = Environment.getExternalStorageDirectory();; localFile = Environment.getRootDirectory()) {
      return new File(localFile.getAbsolutePath() + "/PetDesigner/" + paramString1 + "/" + paramString2).exists();
    }
  }
  
  public void CreateBitmapImageByFileStream(String paramString1, int paramInt1, int paramInt2, String paramString2)
  {
    try
    {
      byte[] arrayOfByte = new byte[8192];
      BufferedInputStream localBufferedInputStream = new BufferedInputStream(Global.GetInstance().m_context.getResources().openRawResource(paramInt1));
      paramString1 = new FileOutputStream(paramString1 + "/" + paramString2 + ".png");
      for (;;)
      {
        paramInt1 = localBufferedInputStream.read(arrayOfByte);
        if (paramInt1 < 0)
        {
          paramString1.flush();
          paramString1.close();
          return;
        }
        paramString1.write(arrayOfByte, 0, paramInt1);
      }
      return;
    }
    catch (IOException paramString1)
    {
      Log.v("test", "Error : " + paramString1);
    }
  }
  
  public void CreateCharacterStatusFileInEditor(int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5, int paramInt6, int paramInt7, int paramInt8, int paramInt9, int paramInt10, int paramInt11, int paramInt12, int paramInt13, int paramInt14, int paramInt15, int paramInt16)
  {
    if ("mounted".equals(Environment.getExternalStorageState())) {}
    for (Object localObject = Environment.getExternalStorageDirectory();; localObject = Environment.getRootDirectory())
    {
      localObject = ((File)localObject).getAbsolutePath() + "/PetDesigner/editor";
      File localFile = new File((String)localObject);
      if (!localFile.exists()) {
        localFile.mkdirs();
      }
      try
      {
        localObject = new FileOutputStream(localObject + "/CharacterStatus.dat");
        ((FileOutputStream)localObject).write(paramInt1);
        ((FileOutputStream)localObject).write(paramInt2);
        ((FileOutputStream)localObject).write(paramInt3);
        ((FileOutputStream)localObject).write(paramInt4);
        ((FileOutputStream)localObject).write(paramInt5);
        ((FileOutputStream)localObject).write(paramInt6);
        ((FileOutputStream)localObject).write(paramInt7);
        ((FileOutputStream)localObject).write(paramInt8);
        ((FileOutputStream)localObject).write(paramInt9);
        ((FileOutputStream)localObject).write(paramInt10);
        ((FileOutputStream)localObject).write(paramInt11);
        ((FileOutputStream)localObject).write(paramInt12);
        ((FileOutputStream)localObject).write(paramInt13);
        ((FileOutputStream)localObject).write(paramInt14);
        ((FileOutputStream)localObject).write(paramInt15);
        ((FileOutputStream)localObject).write(paramInt16);
        ((FileOutputStream)localObject).close();
        return;
      }
      catch (IOException localIOException) {}
    }
  }
  
  public String GetDirectory(String paramString1, String paramString2)
  {
    String str1 = Environment.getExternalStorageState();
    File localFile;
    if ("mounted".equals(str1))
    {
      localFile = Environment.getExternalStorageDirectory();
      String str2 = localFile.getAbsolutePath() + "/PetDesigner/" + paramString1;
      paramString2 = localFile.getAbsolutePath() + "/PetDesigner/" + paramString1 + "/" + paramString2;
      if (!new File(str2).exists()) {
        if (!"mounted".equals(str1)) {
          break label227;
        }
      }
    }
    int i;
    label227:
    for (paramString1 = Environment.getExternalStorageDirectory();; paramString1 = Environment.getRootDirectory())
    {
      paramString1 = paramString1.getAbsolutePath() + "/PetDesigner/editor";
      new File(paramString1).mkdirs();
      i = 1;
      if (i <= 6) {
        break label234;
      }
      Log.v("test", "ImageLoad Manager : -= Create New Directory =-");
      Log.v("test", "ImageLoad Manager : Mounted state : mounted");
      Log.v("test", "ImageLoad Manager : Real SdCard Mounted state : " + str1);
      Log.v("test", "ImageLoad Manager : Last directory : " + paramString1);
      return paramString2;
      localFile = Environment.getRootDirectory();
      break;
    }
    label234:
    if ("mounted".equals(str1)) {}
    for (paramString1 = Environment.getExternalStorageDirectory();; paramString1 = Environment.getRootDirectory())
    {
      paramString1 = paramString1.getAbsolutePath() + "/PetDesigner/Character" + Make00Number(i);
      new File(paramString1).mkdirs();
      if (i == 1)
      {
        CreateBitmapImageByFileStream(paramString1, 2130837561, i, "illust");
        CreateBitmapImageByFileStream(paramString1, 2130837515, i, "char_drop");
        CreateBitmapImageByFileStream(paramString1, 2130837526, i, "char_top");
        CreateBitmapImageByFileStream(paramString1, 2130837527, i, "char_top_move01");
        CreateBitmapImageByFileStream(paramString1, 2130837528, i, "char_top_move02");
        CreateBitmapImageByFileStream(paramString1, 2130837516, i, "char_left");
        CreateBitmapImageByFileStream(paramString1, 2130837517, i, "char_left_move01");
        CreateBitmapImageByFileStream(paramString1, 2130837518, i, "char_left_move02");
        CreateBitmapImageByFileStream(paramString1, 2130837523, i, "char_right");
        CreateBitmapImageByFileStream(paramString1, 2130837524, i, "char_right_move01");
        CreateBitmapImageByFileStream(paramString1, 2130837525, i, "char_right_move02");
        CreateBitmapImageByFileStream(paramString1, 2130837511, i, "char_default01");
        CreateBitmapImageByFileStream(paramString1, 2130837512, i, "char_default02");
        CreateBitmapImageByFileStream(paramString1, 2130837513, i, "char_default03");
        CreateBitmapImageByFileStream(paramString1, 2130837514, i, "char_default04");
        CreateBitmapImageByFileStream(paramString1, 2130837519, i, "char_pose01_01");
        CreateBitmapImageByFileStream(paramString1, 2130837520, i, "char_pose01_02");
        CreateBitmapImageByFileStream(paramString1, 2130837521, i, "char_pose01_03");
        CreateBitmapImageByFileStream(paramString1, 2130837522, i, "char_pose01_04");
        CreateBitmapImageByFileStream(paramString1, 2130837529, i, "char_touch");
        CreateBitmapImageByFileStream(paramString1, 2130837530, i, "char_walk_left01");
        CreateBitmapImageByFileStream(paramString1, 2130837531, i, "char_walk_left02");
        CreateBitmapImageByFileStream(paramString1, 2130837532, i, "char_walk_left03");
        CreateBitmapImageByFileStream(paramString1, 2130837533, i, "char_walk_left04");
        CreateBitmapImageByFileStream(paramString1, 2130837534, i, "char_walk_right01");
        CreateBitmapImageByFileStream(paramString1, 2130837535, i, "char_walk_right02");
        CreateBitmapImageByFileStream(paramString1, 2130837536, i, "char_walk_right03");
        CreateBitmapImageByFileStream(paramString1, 2130837537, i, "char_walk_right04");
      }
      i += 1;
      break;
    }
  }
  
  public String Make00Number(int paramInt)
  {
    if (paramInt >= 10) {
      return paramInt;
    }
    return "0" + paramInt;
  }
}


/* Location:           D:\Tool\AndroidKiller_v1.3.1\projects\petdesigner\ProjectSrc\classes-dex2jar.jar
 * Qualified Name:     pck_ImageLoader.ImageLoadManager
 * JD-Core Version:    0.7.0.1
 */